package com.akxy.pt.tsdb.influxdb.operator;

/**
 * @author Mengfly
 */
public class LimitOperator implements Operator {
    private final int limit;
    private int offset = 0;

    public LimitOperator(int limit, int offset) {
        this.limit = limit;
        this.offset = offset;
    }

    @Override
    public String operatorString() {
        if (offset > 0) {
            return String.format("|> limit(n:%d, offset:%d)", limit, offset);
        } else {
            return String.format("|> limit(n:%d)", limit);
        }
    }
}
